<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学校管理</title>
<%@ include file="../common/importLib.jsp" %>
<link rel="stylesheet" type="text/css" href="../common/css/codeDownload.css">
<script type="text/javascript" src="../common/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="../common/jquery-cascade/js/jquery.cityselect.js"></script>
<script type="text/javascript">
	/**
	 * 增删改查参数设置
	 */
	tableTitle = "学校列表";
	tableURL = getTimeURL("../maintain/schoolInfo/queryPage.do");
	toolbarView = 2;
	tableColumns = [[{field:'ck',checkbox:true},
	                {field:'id',title:'id',width:0,rowspan:1},
	                {field:'userId',title:'userId',width:0,rowspan:1,hidden:'true'},
					{field:'opt',title:'操作',width:80,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){	
							var queryUrl = '../maintain/schoolInfo/queryById.do?id=' + rowData.id;						
							return "<a title='编辑' class='xxl_linkbutton' iconCls='icon-edit' href='javascript:datagridUpdate(\"" + queryUrl + "\")'>编辑</a>";
						}
					},
					{field:'schoolName',title:'校名',width:120,rowspan:1},    
	                {field:'coverUrl',title:'封面',width:80,rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.coverUrl==""){
								return "";
							}else{
								var url=mrjyFile+"maintain/schoolpic/cover/"+rowData.coverUrl+"?"+new Date().getTime();
								return "<img onclick=\"viewPic('"+url+"')\" src='"+url+"' style='width:75px;height:37.5px;'/>";
							}
						}
					},
					{field:'loginCode',title:'账号',width:100,rowspan:1},
					{field:'recommendCode',title:'推广码',width:100,rowspan:1},
					{field:'recommendCod',title:'二维码',width:80,align:'center', rowspan:1,
                        formatter:function(value,rowData,rowIndex){
                            var codeName = rowData.schoolName + "_二维码";
                            return "<a class='xxl_linkbutton saveCode' iconCls='icon-download' href='javascript:openDownWindow(\"" + rowData.promoteUrl + "\",\""+ codeName  +"\");'>下载</a>";
                        }
                    },
					{field:'promoteUrl',title:'推广链接',width:300,rowspan:1},
					{field:'signTimeStr',title:'签订时间',width:150,rowspan:1},
					{field:'contractYear',title:'时限',width:50,rowspan:1},
					{field:'createTimeStr',title:'添加时间',width:150,rowspan:1},
					
					{field:'disableFlag',title:'禁用状态',width:80,align:'center', rowspan:1,
						formatter:function(value,rowData,rowIndex){
							if(rowData.disableFlag == 0){
								return "<font color='green'>起用</font>";
							}else{
								return "<font color='red'>禁用</font>";
							}
						}
					}]];
	
	var addWidth = 800; //添加窗口宽度
	var addHeight = 450; //添加窗口高度
	var addTitle = "添加学校信息"; //添加标题
	var updateWidth = 800; //修改窗口宽度
	var updateHeight = 450; //修改窗口高度
	var updateTitle = "编辑学校信息"; //修改标题
	var updateDisableFlagUri = "schoolInfo/updateDisableFlag.do"; //禁用、起用记录
	var deleteUri = "schoolInfo/deleteByIds.do"; //删除记录
	
	
	$(function(){
		//初始化导出事件
        $("#exportXls").on('click',exportXls);
    });
	
	/**
	 * 初始化添加表单
	 */	
	function initAddForm(){	
		openPicUpload();	
		//每次添加时，先隐藏
		$("#tr_student_school").hide();
        $("#tr_student_grade").hide();
      //绑定自定义权限事件
		$("#infoAuthAdd input[name='infoAuth']").on('click',function(){changeStudentSchoolBox('add')});
		
	}
	
	/**
	 * 初始化修改表单
	 */
	function initUpdateForm(jsonObject){
		openPicUploadUpdate();
		console.log(jsonObject);
		$("#idUpdate").val(jsonObject.info.id);
		$("#userIdUpdate").val(jsonObject.info.userId);
		$("#schoolNameUpdate").val(jsonObject.info.schoolName);
		$("#uploadPicUpdate").attr("src",mrjyFile+"maintain/schoolpic/cover/"+jsonObject.info.coverUrl+"?"+new Date().getTime());
		$("#loginCodeUpdate").val(jsonObject.info.loginCode);
		$("#signTimeStrUpdate").val(jsonObject.info.signTimeStr);
		$("#contractYearUpdate").val(jsonObject.info.contractYear);
		
		//先清除掉，后面有值在渲染
		$("#div_student_school_update").children().remove();
		$("#div_student_grade_update").children().remove();
		if(jsonObject.info.infoAuth){
			var infoAuthArr = jsonObject.info.infoAuth;
			$(infoAuthArr.split(";")).each(function (i,dom){
		        $("#infoAuthUpdate :checkbox[value='"+dom+"']").prop("checked",true);
		    });
			
			if(infoAuthArr.indexOf("2") >= 0){//已选学校
				$("#tr_student_school_update").show();
			    var divSchoolUpdate = $("#div_student_school_update");
			    if(jsonObject.info.studentSchool){
			    	divSchoolUpdate.children().remove();
			    	$(jsonObject.info.studentSchool.split(";")).each(function (i,val){
			    		divSchoolUpdate.append('<input style="margin-right:6px;margin-bottom:3px;" type="text" value="'+ val +'" placeholder="学校名称" name="studentSchool">');
		            });
			    }
			}else{
				$("#tr_student_school_update").hide();
			}
			if(infoAuthArr.indexOf("3") >= 0){//已选班级
                $("#tr_student_grade_update").show();
                var divGradeUpdate = $("#div_student_grade_update");
                if(jsonObject.info.studentGrade){
                	divGradeUpdate.children().remove();
                    $(jsonObject.info.studentGrade.split(";")).each(function (i,val){
                    	var arr = val.split("@_@");
                    	if(arr){
                    		divGradeUpdate.append(
                				'    <div class = "div_student_grade_item_update" style="margin-bottom:5px;"> '
                	            +'    <input type="text" value="'+arr[0]+'" placeholder="年级名称'+ (i+1) +'" name="studentGradeName">'
                	            +'   <input type="text" value="'+arr[1]+'" placeholder="班级最大数" name="studentGradeNum">  '
                	            +'</div>');
                    	}
                    	
                    });
                }
            }else{
                $("#tr_student_grade_update").hide();
                
            }
		}else{
			$("#tr_student_school_update").hide();
            $("#tr_student_grade_update").hide();
		}
		
		//绑定自定义权限事件
        $("#infoAuthUpdate input[name='infoAuth']").on('click',function(){changeStudentSchoolBox('update')});
		
	}
	/**
	 *打开照片上传组件
	 */
	function openPicUpload(){
		uploadCoverImg("uploadFile","/mrjy_file/common/util/uploadImg3.do","1000KB","uploadMessage","backup/maintain/schoolpic/cover/","coverUrl","uploadPic");
	}
	
	/**
	 *打开修改照片上传组件
	 */
	function openPicUploadUpdate(){
		uploadCoverImg("uploadFileUpdate","/mrjy_file/common/util/uploadImg3.do","1000KB","uploadMessageUpdate","backup/maintain/schoolpic/cover/","coverUrlUpdate","uploadPicUpdate");
	}
	 function comboboxLink_1(id1,id2,url1,url2,selectValue1,selectValue2){
			var _zhbid = $('#'+id2).combobox({
		        disabled: true,
		        valueField: 'id',
		        textField: 'text'
		    }).combobox("select",selectValue2);
			var _mkid = $('#'+id1).combobox({
		        url: url1,
		        editable: false,
		        valueField: 'id',
		        textField: 'text',
		        onSelect: function() {
		            _zhbid.combobox({
		                disabled: false,
		                url: url2,
		                valueField: 'id',
		                textField: 'text',
		            }).combobox('clear');
		        }
		    }).combobox("select",selectValue1);
			_zhbid = $('#'+id2).combobox({
		        disabled: true,
		        valueField: 'id',
		        textField: 'text',
		        onSelect: function (data) {
		        	selectClass(data.id);
		        }
		    }).combobox("select",selectValue2);
		}
	/**
	 *打开二维码下载窗口
	 */
	function openDownWindow(urlStr,codeName){
		var downPage = '<div class="codeDownload">'+
			  	'<div class="codeDownload-content">'+
			  		'<div id="code_download"></div>'+
			  		'<select id="codeSize" name="codeSize" class="form-control select-box">'+
			  			'<option value="256">256×256分辨率</option>'+
			  			'<option value="512">512×512分辨率</option>'+
			  			'<option value="1024">1024×1024分辨率</option>'+
			  		'</select>'+
			  		'<a id="download_btn" class="btn download-btn">下载</a>'+
			  		'<a id="cancel_btn" class="btn cancel-btn">取消</a>'+
			  	'</div>'+
			 '</div>';
		$("body").append(downPage);
		$("#code_download").qrcode(urlStr);
		$("#code_download>canvas").width(150);
		$("#code_download>canvas").height(150);
		$("#download_btn").on('click',function(){
			var size = $("#codeSize").val();
			saveCode(urlStr,size,size,codeName);
		})
		$("#cancel_btn").on('click',function(){
			$(".codeDownload").remove();
		})
	}
	/**
	 * 二维码下载
	 */
	function saveCode(content,width,height,codeName){
		width = width?width:512;
		height = height?height:512;
		$('#code_download').html("").qrcode({
			render:"canvas",
			width: width,
			height:height,
			correctLevel:0,
			text:content
		});
		$("#code_download>canvas").width(150);
		$("#code_download>canvas").height(150);
		var myCanvas = $("#code_download>canvas")[0];
	    var image = myCanvas.toDataURL("image/png").replace("image/png", "image/octet-stream;Content-Disposition: attachment;filename=myCode.png");   
	//  window.location=image; // it will save locally
		var a = document.createElement("a");
		//codeName = codeName+"_"+new Date().getTime();
		a.download = codeName + ".jpg";
		a.href = image;
		a.click();
		$(".codeDownload").remove();
	}
	
	function exportXls(){
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        
        var schoolName = $("#schoolName").val()==undefined? '' : $("#schoolName").val();
        $.messager.confirm('导出', '是否导出学校信息列表？' ,function(r){
            if(r){
                location.href=getTimeURL("../maintain/schoolInfo/exportSchoolInfoBack.do?startTime="+startTime+"&endTime="+endTime+"&schoolName="+schoolName);      
            }
        });
   }
	//新增提交方法
	function addFormSubmit(){
		var params = getFormJson($('#add_form'));
		var infoAuth = "" ;
		$.each($('#infoAuthAdd input[name="infoAuth"]'),function(){
            if(this.checked){
            	infoAuth += $(this).val() + ";";
            }
        });
        if(infoAuth.length > 0){
        	infoAuth = infoAuth.substring(0,infoAuth.length-1);
            params.infoAuth = infoAuth ;
        }
        if(infoAuth.indexOf("2") >= 0){//有选择学校
        	var studentSchool = "";
            $("#div_student_school input[name='studentSchool']").each(function(index,item){
                studentSchool += $(this).val() + ";";
            });
            if(studentSchool.length > 0){
                studentSchool = studentSchool.substring(0,studentSchool.length-1);
                params.studentSchool = studentSchool ;
            }
        }else{
        	 params.studentSchool = '' ;
        }
        if(infoAuth.indexOf("3") >= 0){//有选择班级
        	var studentGrade = "";
        	var divGrade = $("#div_student_grade");
            var divItmes = divGrade.children('div[class="div_student_grade_item"]');
            for(var i = 0 ; i < divItmes.size() ; i++){
            	var item = divItmes[i];
            	var studentGradeName = $(item).children('input[name="studentGradeName"]').val();
            	var studentGradeNum = $(item).children('input[name="studentGradeNum"]').val();
            	studentGrade += studentGradeName + '@_@' + studentGradeNum + ";" ;
            }
            if(studentGrade.length > 0){
            	studentGrade = studentGrade.substring(0,studentGrade.length-1);
                params.studentGrade = studentGrade ;
            }
        }else{
        	params.studentGrade = '' ;
        }
		$.ajax({
			  type: 'POST',
			  url: '../maintain/schoolInfo/addSchoolInfo.do',
			  data: params,
			  dataType: 'json',
			  async: false,
			  success: function(data){
				  if(data.err_code ==0){
					  $('#datagrid_add').window('close');
					  $('#datagrid_table').datagrid('reload');
				  }else {
					alert(data.err_msg);
				  }
			  },
			  error: function(xhr, type){
			    alert('Ajax error!')
			  }
		});
	}
	//更新提交的方法
	function updateFormSubmit(){
		var params = getFormJson($('#update_form'));
		var infoAuth = "" ;
        $.each($('#infoAuthUpdate input[name="infoAuth"]'),function(){
            if(this.checked){
                infoAuth += $(this).val() + ";";
            }
        });
        if(infoAuth.length > 0){
            infoAuth = infoAuth.substring(0,infoAuth.length-1);
            params.infoAuth = infoAuth ;
        }
        if(infoAuth.indexOf("2") >= 0){//有选择学校
            var studentSchool = "";
            $("#div_student_school_update input[name='studentSchool']").each(function(index,item){
                studentSchool += $(this).val() + ";";
            });
            if(studentSchool.length > 0){
                studentSchool = studentSchool.substring(0,studentSchool.length-1);
                params.studentSchool = studentSchool ;
            }
        }else{
             params.studentSchool = '' ;
        }
        if(infoAuth.indexOf("3") >= 0){//有选择班级
            var studentGrade = "";
            var divGrade = $("#div_student_grade_update");
            var divItmes = divGrade.children('div[class="div_student_grade_item_update"]');
            for(var i = 0 ; i < divItmes.size() ; i++){
                var item = divItmes[i];
                var studentGradeName = $(item).children('input[name="studentGradeName"]').val();
                var studentGradeNum = $(item).children('input[name="studentGradeNum"]').val();
                studentGrade += studentGradeName + '@_@' + studentGradeNum + ";" ;
            }
            if(studentGrade.length > 0){
                studentGrade = studentGrade.substring(0,studentGrade.length-1);
                params.studentGrade = studentGrade ;
            }
        }else{
            params.studentGrade = '' ;
        }
        console.log(params);
		$.ajax({
			  type: 'POST',
			  url: '../maintain/schoolInfo/updateById.do',
			  data: params,
			  dataType: 'json',
			  async: false,
			  success: function(data){
				  if(data.err_code ==0){
					  $('#datagrid_update').window('close');
					  $('#datagrid_table').datagrid('reload');
				  }else {
					alert( data.err_msg);
				  }
			  },
			  error: function(xhr, type){
			    alert('Ajax error!')
			  }
		});
	}
	//将form中的值转换为键值对。
	function getFormJson(frm) {
	    var o = {};
	    var a = $(frm).serializeArray();
	    $.each(a, function () {
	        if (o[this.name] !== undefined) {
	            if (!o[this.name].push) {
	                o[this.name] = [o[this.name]];
	            }
	            o[this.name].push(this.value || '');
	        } else {
	            o[this.name] = this.value || '';
	        }
	    });

	    return o;
	}
	//自定义权限，多选框的选中事件
	function changeStudentSchoolBox(type){
		var infoAuth = "" ;
		if(type == 'add'){
			$.each($('#infoAuthAdd input[name="infoAuth"]'),function(){
	            if(this.checked){
	                infoAuth += $(this).val() + ";";
	            }
	        });
	        if(infoAuth){
	            if(infoAuth.indexOf("2") >= 0){
	                $("#tr_student_school").show();
	            }else{
	                $("#tr_student_school").hide();
	            }
	            
	            if(infoAuth.indexOf("3") >= 0){
	                $("#tr_student_grade").show();
	            }else{
	                $("#tr_student_grade").hide();
	            }
	            
	        }else{
	            $("#tr_student_school").hide();
	            $("#tr_student_grade").hide();
	        }
		}else if(type == 'update'){
			$.each($('#infoAuthUpdate input[name="infoAuth"]'),function(){
                if(this.checked){
                    infoAuth += $(this).val() + ";";
                }
            });
            if(infoAuth){
                if(infoAuth.indexOf("2") >= 0){
                    $("#tr_student_school_update").show();
                }else{
                    $("#tr_student_school_update").hide();
                }
                
                if(infoAuth.indexOf("3") >= 0){
                    $("#tr_student_grade_update").show();
                }else{
                    $("#tr_student_grade_update").hide();
                }
                
            }else{
                $("#tr_student_school_update").hide();
                $("#tr_student_grade_update").hide();
            }
		}
        
		
	}
	//添加学校输入框
	function addChildStudentSchool(type){
		var divSchool = "";
		if(type == 'add'){
			divSchool = $("#div_student_school");
	        if(divSchool.children('input').size()%3 == 0){
	            divSchool.append("<br/>");
	            divSchool.append('<input style="margin-right:6px;margin-bottom:3px;" type="text" placeholder="学校名称'+(divSchool.children('input').size()+1)+'" name="studentSchool">');
	        }else{
	            divSchool.append('<input style="margin-right:6px;margin-bottom:3px;" type="text" placeholder="学校名称'+(divSchool.children('input').size()+1)+'" name="studentSchool">');
	        }
		}else if(type == 'update'){
			divSchool = $("#div_student_school_update");
            if(divSchool.children('input').size()%3 == 0){
                divSchool.append("<br/>");
                divSchool.append('<input style="margin-right:6px;margin-bottom:3px;" type="text" placeholder="学校名称'+(divSchool.children('input').size()+1)+'" name="studentSchool">');
            }else{
                divSchool.append('<input style="margin-right:6px;margin-bottom:3px;" type="text" placeholder="学校名称'+(divSchool.children('input').size()+1)+'" name="studentSchool">');
            }
		}
		
	}
	
	//删除学校输入框
    function removeChildStudentSchool(type){
    	var divSchool = "";
		if(type == 'add'){
			divSchool = $("#div_student_school");
		}else if(type == 'update'){
			divSchool = $("#div_student_school_update");
		}
		
		if(divSchool.children('input').size() == 1){
            alert("学校信息最少要有一个");
        }else{
            if(divSchool.children("br:last-child").size() == 1){
                divSchool.children("br:last-child").remove();
            }
            divSchool.children("input:last-child").remove();
        }
		
	}
	
    //添加班级输入框
    function addChildStudentGrade(type){
    	var divGrade = "" ;
    	if(type == 'add'){
    		divGrade = $("#div_student_grade");
    		var num = divGrade.children('div[class="div_student_grade_item"]').size();
            divGrade.append(
                '   <div class = "div_student_grade_item" style="margin-bottom:5px;"> '
                +'    <input type="text" placeholder="年级名称'+ (num+1) +'" name="studentGradeName">'
                +'   <input type="text" placeholder="班级最大数" name="studentGradeNum">  '
                +'</div>');
    	}else if(type == 'update'){
    		divGrade = $("#div_student_grade_update");
    		var num = divGrade.children('div[class="div_student_grade_item_update"]').size();
            divGrade.append(
                '   <div class = "div_student_grade_item_update" style="margin-bottom:5px;"> '
                +'    <input type="text" placeholder="年级名称'+ (num+1) +'" name="studentGradeName">'
                +'   <input type="text" placeholder="班级最大数" name="studentGradeNum">  '
                +'</div>');
    	}
    	
    	
    	
    }
    
    //删除班级输入框
    function removeChildStudentGrade(type){
    	var divGrade = "" ;
    	if(type == 'add'){
    		divGrade = $("#div_student_grade");
    		var num = divGrade.children('div[class="div_student_grade_item"]').size();
            if(num == 1){
                alert("班级信息最少要有一个");
            }else{
                divGrade.children("div[class='div_student_grade_item']:last-child").remove();
            }
    	}else if(type == 'update'){
    		divGrade = $("#div_student_grade_update");
    		var num = divGrade.children('div[class="div_student_grade_item_update"]').size();
            if(num == 1){
                alert("班级信息最少要有一个");
            }else{
                divGrade.children("div[class='div_student_grade_item_update']:last-child").remove();
            }
    	}
    }
	
</script>
<script type="text/javascript">
</script>
</head>
<body id="layout" class="easyui-layout">
<div style="background: none repeat scroll 0% 0% #EFEFEF; height:75px; padding: 6px 2px; border-bottom: 1px solid #CCC;"
		region="north"  split="false" title="条件查询">
	<form  id="searchForm" >
	<table>
		<tr>
		    <td width ="10px;"></td>
			<td>学校名称名称：</td><td><input type="text" name="schoolName"/> </td>	
			<td width ="30px;"></td>
			<td>时间：</td>
			<td>
			    <input type="text" name="startTime" id="startTime" style="width:120px;" class="input-style" onclick="WdatePicker({el:'startTime',maxDate:'#F{$dp.$D(\'endTime\')}',dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/>
                <span style="padding: 0 6px 0 2px;">至</span>
                <input type="text" name ="endTime" id="endTime"  style="width: 120px;" class="input-style" onclick="WdatePicker({el:'endTime',minDate:'#F{$dp.$D(\'startTime\')}',dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/>
            </td>
            		
            <td width ="30px;"></td>										
			<td><a class="easyui-linkbutton" id="search" iconCLs="icon-search"  onclick="searchTable()">搜索</a></td>
			<!-- <td><a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('searchForm').reset();reload();">清空</a></td> -->
		    <td><a class="easyui-linkbutton" iconCLs="icon-excel" id="exportXls">导出</a></td>
		</tr>
	</table>
	</form>
	</div>
	<div region="center">
	<!-- datagrid信息表 -->
	<table id="datagrid_table"></table>
	<!-- 添加记录 -->
	<style>
		#datagrid_add,#datagrid_update{
			padding:  10px 20px;
		}
	
		#datagrid_add tr,#datagrid_update tr{
		    height: 30px;
		}
		
	</style>
	<div id="datagrid_add">
		<form id="add_form" action="" method="post">
			<input type="hidden" id="coverUrl" name="coverUrl" onclick='openPicUpload()'>
			<table width="720" class="xxl_tb_1">
				<tbody>	
					<tr>
						<td class="xxl_td_2">学校名称：</td>
						<td ><input type="text" id="schoolName" name="schoolName" /></td>
					</tr>
					<tr >
                        <td class="xxl_td_2">上传封面：</td>
                        <td ><input id='uploadFile' type='file' name='uploadFile'/><span id='uploadMessage' style='margin-left:10px'></span></td>    
                        <td ><img style="width: 150px;height: 75px;" id ="uploadPic" src=""/><div style="color:red"> *照片后缀名为jpg/png，格式为750*375px</div></td>
                    </tr>
					<tr>
						<td >管理员账号：</td>
						<td><input type="text" id="loginCode" name="loginCode"/></td>
					</tr>
					<tr >
						<td >管理密码：</td>
						<td><input type="password" id="passwordSrc" name="passwordSrc" /></td>
					</td>
					</tr>
					<tr>
                        <td >合同开始时间：</td>
                        <td><input type="text" name="signTimeStr" id="signTimeStr" style="width: 150px;" class="input-style" onclick="WdatePicker({el:'signTimeStr', dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/></td>
                    </tr>
                    <tr>
                        <td >合同年限：</td>
                        <td><input type="text" id="contractYear" name="contractYear" class="easyui-numberbox" min="0" precision="0" max="100" /></td>
                    </tr>
                     <tr>
                        <td >自定义权限：</td>
                        <td td colspan="2">
                            <div id="infoAuthAdd">
	                            <input type="checkbox" name="infoAuth" value="0"/>孩子学号
	                            <input type="checkbox" name="infoAuth" value="1"/>孩子姓名
	                            <input type="checkbox" name="infoAuth" value="2"/>孩子学校
	                            <input type="checkbox" name="infoAuth" value="3"/>孩子班级
	                            <input type="checkbox" name="infoAuth" value="4"/>手机号码
                            </div>
                        </td>
                    </tr>
                    <tr id = "tr_student_school" style="display: none;">
                        <td colspan="3">
                            <div>
                                <div style="margin-bottom:5px;">
                                    <span style="color:#CCC;margin-right:10px;">用于学校下拉选项</span>
                                    <a title='添加学校' class='xxl_linkbutton' iconCls='icon-add' href='javascript:addChildStudentSchool("add");'>添加学校</a>
                                    <a title='删除学校' class='xxl_linkbutton' iconCls='icon-remove' href='javascript:removeChildStudentSchool("add");'>删除学校</a>
                                </div> 
                                <div id="div_student_school">
                                    <input style="margin-bottom:3px;" type="text" placeholder="学校名称" name="studentSchool">
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr id = "tr_student_grade" style="display: none;">
                        <td colspan="3">
                            <div>
                                <div style="margin-bottom:5px;">
                                    <span style="color:#CCC;margin-right:10px;">用于班级下拉选项</span>
                                    <a title='添加班级' class='xxl_linkbutton' iconCls='icon-add' href='javascript:addChildStudentGrade("add");'>添加班级</a>
                                    <a title='删除班级' class='xxl_linkbutton' iconCls='icon-remove' href='javascript:removeChildStudentGrade("add");'>删除班级</a>
                                </div> 
                                <div id="div_student_grade">
                                    <div class = "div_student_grade_item" style="margin-bottom:5px;">
                                        <input type="text" placeholder="年级名称1" name="studentGradeName">
                                        <input type="text" placeholder="班级最大数" name="studentGradeNum">  
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
					
					<tr></tr>
					<tr>
						<td colspan="3" style="text-align: center">					
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="addFormSubmit()">添加</a>
							<a class="easyui-linkbutton" iconCls="icon-undo" onclick="document.getElementById('add_form').reset()">重置</a>
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_add').window('close');">取消</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
	
	<!-- 修改记录 -->
	<div id="datagrid_update">
		<form id="update_form" action="" method="post">
			<input type="hidden" id="idUpdate" name="id"/>
			<input type ="hidden" id="userIdUpdate" name="userId">
			<input type="hidden" id="coverUrlUpdate" name="coverUrl" onclick='openPicUploadUpdate()'>
			<table width="630" class="xxl_tb_1">
				<tbody>
					<tr>
                        <td class="xxl_td_2">学校名称：</td>
                        <td ><input type="text" id="schoolNameUpdate" name="schoolName" /></td>
                    </tr>
                    <tr >
                        <td class="xxl_td_2">上传封面：</td>
                        <td ><input id='uploadFileUpdate' type='file' name='uploadFile'/><span id='uploadMessageUpdate' style='margin-left:10px'></span></td>    
                        <td ><img style="width: 150px;height: 75px;" id ="uploadPicUpdate" src=""/><div style="color:red"> *照片后缀名为jpg/png，格式为750*375px</div></td>
                    </tr>
                    <tr>
                        <td >管理员账号：</td>
                        <td><input type="text" id="loginCodeUpdate" name="loginCode"/></td>
                    </tr>
                    <tr >
                        <td >管理密码：</td>
                        <td><input type="password" id="passwordSrcUpdate" name="passwordSrc" /></td>
                    </td>
                    </tr>
                    <tr>
                        <td >合同开始时间：</td>
                        <td><input type="text" name="signTimeStr" id="signTimeStrUpdate" style="width: 150px;" class="input-style" onclick="WdatePicker({el:'signTimeStrUpdate', dateFmt: 'yyyy-MM-dd HH:mm:ss'})"/></td>
                    </tr>
                    <tr>
                        <td >合同年限：</td>
                        <td><input type="text" id="contractYearUpdate" name="contractYear" class="easyui-numberbox" min="0" precision="0" max="100" /></td>
                    </tr>
                    <tr>
                        <td >自定义权限：</td>
                        <td td colspan="2">
                            <div id="infoAuthUpdate">
                                <input type="checkbox" name="infoAuth" value="0"/>孩子学号
	                            <input type="checkbox" name="infoAuth" value="1"/>孩子姓名
	                            <input type="checkbox" name="infoAuth" value="2"/>孩子学校
	                            <input type="checkbox" name="infoAuth" value="3"/>孩子班级
	                            <input type="checkbox" name="infoAuth" value="4"/>手机号码
                            </div>
                        </td>
                    </tr>
                    <tr id = "tr_student_school_update" style="display: none;">
                        <td colspan="3">
                            <div>
                                <div style="margin-bottom:5px;">
                                    <span style="color:#CCC;margin-right:10px;">用于学校下拉选项</span>
                                    <a title='添加学校' class='xxl_linkbutton' iconCls='icon-add' href='javascript:addChildStudentSchool("update");'>添加学校</a>
                                    <a title='删除学校' class='xxl_linkbutton' iconCls='icon-remove' href='javascript:removeChildStudentSchool("update");'>删除学校</a>
                                </div> 
                                <div id="div_student_school_update">
                                    
                                </div>
                            </div>
                        </td>
                    </tr>
                    <tr id = "tr_student_grade_update" style="display: none;">
                        <td colspan="3">
                            <div>
                                <div style="margin-bottom:5px;">
                                    <span style="color:#CCC;margin-right:10px;">用于班级下拉选项</span>
                                    <a title='添加班级' class='xxl_linkbutton' iconCls='icon-add' href='javascript:addChildStudentGrade("update");'>添加班级</a>
                                    <a title='删除班级' class='xxl_linkbutton' iconCls='icon-remove' href='javascript:removeChildStudentGrade("update");'>删除班级</a>
                                </div> 
                                <div id="div_student_grade_update">
                                    <!-- <div class = "div_student_grade_update_item" style="margin-bottom:5px;">
                                        <input type="text" placeholder="年级名称1" name="studentGradeName">
                                        <input type="text" placeholder="班级最大数" name="studentGradeNum">  
                                    </div> -->
                                </div>
                            </div>
                        </td>
                    </tr>
                    
                    <tr></tr>
					<tr>
						<td colspan="3" style="text-align: center">
							<a class="easyui-linkbutton" iconCls="icon-ok" onclick="updateFormSubmit()">修改</a>		
							<a class="easyui-linkbutton" iconCls="icon-cancel" onclick="$('#datagrid_update').window('close');">取消</a>
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	</div>
	
</body>
</html>